<template>
  <div class="supervise-mine-flow"
       :class="{
      'print-supervise': !showPagination
    }">
    <SpecialSearchCondition v-if="isShowSpecialSearchCondition"
                            :listData="specialSearchConditionList"
                            :selectedValue="specialSearchSelectedValue"
                            @itemClicked="onSpecialSearchConditionClicked"></SpecialSearchCondition>
    <div class="condition-content"
         :id="searchConditionContainerId"></div>
    <div class="main-header">
      <CommonCounter v-show="selectedRowKeys.length"
                     :total="pagination.total"
                     :currentSelected="selectedRowKeys.length"
                     @cancelSelected="cancelSelected" />
      <div class="toolbar">
        <CommonToolbar :allToolBtns="allToolBtns"
                       @buttonClick="buttonClick"> </CommonToolbar>
      </div>
      <div class="search-part">
        <a-input-search class="search-input"
                        :placeholder="$i18n('collaboration.new.template.search.keyWords')"
                        :allowClear="true"
                        @change="onInputSearchValueChange"
                        @search="onSearch"
                        @buttonClick="buttonClick" />
        <div class="search-button">
          <SearchCondition class="search-condition"
                           :containerParentId="searchConditionContainerId"
                           :conditions="searchConditions"
                           @valueChange="conditionValueChange">
          </SearchCondition>
        </div>
      </div>
    </div>
    <div class="main-content"
         ref="tableContent">
      <div>
        <AVirtuallyTable ref="table"
                         :row-selection="{
            columnWidth: 60,
            selectedRowKeys: selectedRowKeys,
            onChange: onSelectChange,
            onSelect: onSelectRecord
          }"
                         rowKey="id"
                         size="small"
                         :pagination="showPagination"
                         :paginationOption="pagination"
                         :loading="tableLoading"
                         :columns="columns"
                         :openVirtuallyModel="false"
                         :dataSource="dataSource"
                         :titleRightMenus="titleRightMenus"
                         :localstorageKey="getLocalStorageKey"
                         @paginationChange="handleTableChange"
                         @paginationShowSizeChange="paginationShowSizeChange">
          <span @click="
              titleClick(record, {
                managerType: urlParamObj.managerType,
                dataType: dataType
              })
            "
                slot="subject"
                :title="text"
                class="pointer set-title-width"
                slot-scope="{ text, record }">
            <!-- 重要程度 -->
            <i class="danger-color"
               :class="getTitleIcon('importantLevel', record.importantLevel)"
               v-if="
                record.importantLevel != '' &&
                record.importantLevel != -1 &&
                record.importantLevel != 1
              "></i>
            <!-- 流程状态 -->
            <i v-if="record.state != null && record.state != '' && record.state != '0'"
               class="flow-state-color"
               :class="getTitleIcon('state', record.state)"></i>
            {{ text }}
            <i v-if="record.hasAttachment"
               :class="getTitleIcon('hasAttachment', record.hasAttachment)"></i>
            <i v-if="record.bodyType && record.bodyType != '10' && record.bodyType != '90'"
               class="form-text-color"
               :class="getTitleIcon('bodyType', record.bodyType)"></i>
          </span>
          <span class="pointer link-color"
                slot="processLog"
                slot-scope="{ record }"
                @click="showDetailLogDialog(record.summaryId, record.processId, 2, record.affairId)">
            <i class="xicon-form-text"></i>
          </span>
          <span slot="currentNodesInfo"
                slot-scope="{ text, record }">
            <span v-if="record.quickSend"
                  :title="text">
              {{ text }}
            </span>
            <span v-else
                  @click="showFlowChart(record)"
                  class="link-color pointer"
                  :title="text">
              {{ text }}</span>
          </span>
          <span :class="{
              'danger-color': isRedDate(text)
            }"
                slot="deadlineDatetimeName"
                slot-scope="{ text }">
            {{ text }}
          </span>
          <span class="link-color pointer"
                slot="_summarybutton"
                @click="superviseContent(record, initTableData)"
                slot-scope="{ record }">
            {{ $i18n('supervise.superviseDetailList.content') }}
          </span>
          <span class="link-color pointer"
                :class="{
              'danger-color': isRedDate(text)
            }"
                :id="`awakeDate_${record.superviseDetailId || record.id}`"
                @click="changeAwake($event, record, globalParam.templeteIds, initTableData)"
                slot="awakeDate"
                slot-scope="{ text, record }">
            {{ text }}
          </span>
        </AVirtuallyTable>
      </div>
    </div>
  </div>
</template>

<script>
  const IE8 = () => {
    try {
      var ua = navigator.userAgent;
      var isMSIE = navigator.appName == 'Microsoft Internet Explorer' || ua.indexOf('Trident') != -1;
      var isMSIE8 = isMSIE && ua.indexOf('MSIE 8') != -1;
      return isMSIE8;
    } catch (e) {
      return false;
    }
  };
  import CommonToolbar from '@/components/common-toolbar/index';
  import CommonCounter from '@/components/common-counter/index';
  import SearchCondition from '@/components/search-condition/index.vue';
  import SpecialSearchCondition from '../components/special-search-condition.vue';

  import AVirtuallyTable from '@/ant-virtually-table/table.vue';
  import { getParams, loadComponentsThemeDefaultCSS } from '@/utils';
  import superviseMixin from '@/mixins/supervise/supervise-mixin.js';
  import smartCodeMixin from '@/mixins/smart-code-mixin';
  import collaboration from '@/utils/collaboration.js';
  import { formatRequestDataToJSON, loadExtendResource } from '@/utils/api';
  import * as Fiber from 'fiber';
  export default {
    name: 'SuperviseMineFlow',
    components: {
      CommonToolbar,
      CommonCounter,
      SearchCondition,
      AVirtuallyTable,
      SpecialSearchCondition
    },
    props: ['dataType', 'needStatisticsVal', 'statisRecieveData'],
    mixins: [superviseMixin, smartCodeMixin],
    data() {
      return {
        searchConditionContainerId: 'search-condition-container-parent',
        // showType: 0, // 数据呈现颗粒度 0：无， 1：节点，2：泳道
        // specialSearchConditionList: [],
        // specialSearchSelectedValue: '',
        // specialSearchConditionParams: null,
        dataSource: [],
        columns: [],
        selectedRowKeys: [],
        urlParamObj: {},
        titleRightMenus: {
          asc: true,
          desc: true,
          freeze: true,
          fieldset: true
        },
        pagination: {
          page: 1,
          total: 0
        },
        searchValue: '',
        selectedRows: [],
        isAdmin: false,
        searchConditions: [],
        advancedParams: null,
        showPagination: true,
        tableLoading: false,
        hasProcessShowType: false // 密级开关
      };
    },
    computed: {
      getLocalStorageKey() {
        return window._currentUser.id + 'SUPERVISE_STATISTIC';
      },
      allToolBtns() {
        const { dataType, isAdmin } = this;
        const allMenuList = [
          {
            //编辑流程
            id: 'editWorkFlow',
            name: this.$i18n('common.design.workflow.label')
          },
          {
            //批量修改流程
            id: 'batchEditWorkFlow',
            name: this.$i18n('collaboration.common.workflow.supervise.batch.modify'),
            tip: [
              this.$i18n('workflow.manager.supervise.modify.mag4.js'),
              '1.' + this.$i18n('workflow.manager.supervise.modify.mag5.js'),
              '2.' + this.$i18n('workflow.manager.supervise.modify.mag6.js'),
              '3.' + this.$i18n('workflow.manager.supervise.modify.mag7.js')
            ],
            subMenu: [
              {
                id: 'batchEditFlow',
                name: this.$i18n('collaboration.common.workflow.supervise.batch.modify')
                //批量修改流程
              },
              {
                id: 'batchEditAllFlow',
                name: this.$i18n('collaboration.common.workflow.supervise.batch.modify.all')
                //修改所有流程
              }
            ]
          },
          {
            //修改日志
            id: 'editWorkFlowLog',
            name: this.$i18n('collaboration.common.workflow.supervise.batch.modify.log')
          },
          // {
          //   //流程终止
          //   id: 'processEnd',
          //   name: this.$i18n('supervise.process.End')
          // },
          // {
          //   //流程撤销
          //   id: 'processRevoke',
          //   name: this.$i18n('common.toolbar.repeal.label')
          // },
          // {
          //   id: 'SkipNode',
          //   name: this.$i18n('workflow.manager.skipthisnode.label.js')
          //   //节点跳转
          // },
          // {
          //   id: 'stepBackToTargetNode',
          //   name: this.$i18n('common.workflow.specialback.label')
          //   //指定回退
          // },
          // {
          //   id: 'NodeReplacebatch',
          //   name: this.$i18n('workflow.manager.nodeReplaceItem.label.js')
          //   //节点批量替换
          // },
          // {
          //   id: 'processRevive',
          //   name: this.$i18n('supervise.process.revive')
          //   //流程复活
          // },
          {
            //催办
            id: 'urge',
            name: this.$i18n('common.portal.section.affair.remind.label')
          },
          {
            //导出
            id: 'exportExcel',
            name: this.$i18n('common.export.label')
          },
          {
            // 打印
            id: 'print',
            name: this.$i18n('common.toolbar.print.label')
          },
          {
            //删除
            id: 'deleteSupervise',
            name: this.$i18n('common.toolbar.delete.label')
          },
          this.smartCodeBtnInfo
        ];
        const showMenuMap = {
          editWorkFlow: {
            show: dataType !== 'done'
          },
          batchEditWorkFlow: {
            show: dataType !== 'done'
          },
          deleteSupervise: {
            show: dataType === 'done'
          },
          editWorkFlowLog: {
            show: true
          },
          // 管理员后台界面 这次不做
          // processEnd: {
          //   show: isAdmin
          // },
          // processRevoke: {
          //   show: isAdmin
          // },
          // SkipNode: {
          //   show: isAdmin && !IE8()
          // },
          // stepBackToTargetNode: {
          //   show: isAdmin
          // },
          // NodeReplacebatch: {
          //   show: isAdmin
          // },
          // processRevive: {
          //   show: isAdmin
          // },
          urge: {
            show: true
          },
          exportExcel: {
            show: ['all', 'pending', 'done'].includes(dataType)
          },
          print: {
            show: true
          },
          smartCode: {
            show: this.isHaveSmartCodePermission()
          }
        };
        const showMenuList = allMenuList.filter((menu) => {
          return showMenuMap[menu.id]?.show;
        });
        return showMenuList;
      }
      // isShowSpecialSearchCondition() {
      //   if (
      //     this.showType != 0 &&
      //     this.specialSearchConditionList &&
      //     this.specialSearchConditionList.length > 0
      //   ) {
      //     return true;
      //   } else {
      //     return false;
      //   }
      // }
    },
    watch: {
      dataType() {
        this.selectedRowKeys = [];
        this.initPageMetaData({
          superviseBoxType: this.dataType
        });
      }
    },
    created() {
      this.columnMap = {
        subject: {
          // 标题
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: 'subject' },
          customCell: () => {
            return {
              style: {
                cursor: 'pointer'
              }
            };
          }
        },
        title: {
          // 标题
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: 'subject' },
          customCell: () => {
            return {
              style: {
                cursor: 'pointer'
              }
            };
          }
        },
        initiator: {
          // 发起人
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          }
        },
        senderName: {
          // 发起人
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          }
        },
        sendDate: {
          // 发起时间
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          }
        },
        currentNodesInfo: {
          // 当前待办人
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: 'currentNodesInfo' }
        },
        deadlineDatetimeName: {
          // 流程期限
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: 'deadlineDatetimeName' }
        },
        deadlineName: {
          // 流程期限
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: 'deadlineDatetimeName' }
        },
        processDeadlineDatetimeName: {
          // 流程期限
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: 'deadlineDatetimeName' }
        },
        processLog: {
          // 流程日志
          dropdownMenus: {
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: 'processLog' }
        },
        memberName: {
          // 事项所属人
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          }
        },
        _summarybutton: {
          // 督办摘要
          dropdownMenus: {
            asc: false,
            desc: false,
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: '_summarybutton' }
        },
        awakeDate: {
          // 督办期限
          dropdownMenus: {
            asc: true,
            desc: true,
            freeze: true,
            fieldset: true
          },
          scopedSlots: { customRender: 'awakeDate' }
        }
      };
      //按钮和表头都由前端写死
      this.urlParamObj = getParams(window.location.search);

      this.initPageMetaData({
        superviseBoxType: this.dataType
      });
      loadComponentsThemeDefaultCSS(window._ctxPath + window._ctpSkinUrl);
    },
    methods: {
      initTableData(params, callBack) {
        this.$refs.table.cleanSelection();
        this.tableLoading = true;
        const { managerType, templeteIds } = this.urlParamObj;
        const { sourceType, templateIds } = this.globalParam;
        let url = `${window._ctxPath}/ajax.do`;
        let urlParms = {
          method: 'ajaxAction'
        };
        let managerMethod = 'getAllSuperviseList4Col';
        const dataType = this.dataType;
        let operationType = '';
        if (sourceType === 1) {
          operationType = 'self';
        }
        if ((sourceType !== 3 && templateIds) || templeteIds) {
          operationType = 'template';
        }
        const chosenType =
          (operationType === '' && this.advancedParams && this.advancedParams.operationType) ||
          templeteIds;
        const adParams = this.advancedParams || {};
        if (adParams.operationTypeIds === undefined || adParams.operationTypeIds === '') {
          adParams.operationTypeIds = templeteIds || templateIds || '';
        }
        let cachParams = {
          managerType: managerType,
          dataType,
          flowstate: '0',
          // sourceType: sourceType + '',
          subject: this.searchValue,
          operationType: operationType,
          ...((dataType === 'pending' || dataType === 'done') && {
            status: dataType === 'pending' ? '0' : '1'
          }),
          ...adParams,
          ...(sourceType === 3 && !chosenType && { sourceType: '3' }),
          ...params
        };

        this.cachParams = cachParams;
        const sendParams = [
          { page: this.pagination.page, size: this.pagination.pageSize },
          cachParams
        ];
        if (dataType == 'all' || dataType == 'pending' || dataType == 'done') {
          if (this.hasProcessShowType) {
            urlParms.managerName = 'workflowManageManager';
            managerMethod = 'getSuperviseListForOverDue';
          } else {
            urlParms.managerName = 'superviseManager';
            managerMethod = 'getAllSuperviseList4Col';
          }
        } else {
          urlParms.managerName = 'workflowManageManager';
          managerMethod = 'getSuperviseListForOverDue';
        }

        url = this.mergeUrlParams(url, urlParms);

        const args = `managerMethod=${managerMethod}&arguments=${formatRequestDataToJSON(
          sendParams
        )}`;

        if (this.cancelToken && this.cancelToken.cancel) {
          this.cancelToken.cancel();
          this.cancelToken = null;
        }
        this.cancelToken = axios.CancelToken.source();

        window.axios
          .post(url, args, {
            cancelToken: this.cancelToken.token,
            headers: {
              'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
            }
          })
          .then((data) => {
            const result = data.data;
            if (result) {
              this.pagination.total = result.total;
              this.dataSource = result.data;
              if (params && params.clickedItemId) {
                $('#count_' + params.clickedItemId).text(result.total);
              }
              if (this.statisRecieveData?.pageHead) {
                let curItem = this.statisRecieveData.pageHead.items.find((item) => {
                  return item.key === this.dataType;
                });

                curItem && (curItem.value = result.total);
                // this.$emit('updadeStatisticsBar', this.statisRecieveData);
              }
            }
            if (this.specialSearchConditionParams?.clickedItemId) {
              this.specialSearchConditionList.forEach((item) => {
                if (this.specialSearchConditionParams.operationTypeIds == item.templateId) {
                  item.values.forEach((val) => {
                    if (val.id == this.specialSearchConditionParams.clickedItemId) {
                      val.name = val.name.replace(/(>\S*<)/, `>${result.total}<`);
                    }
                  });
                }
              });
            }
            this.tableLoading = false;
            callBack && callBack();
          });
      },
      onSelectChange(selectedRowKeys, selectedRows) {
        this.selectedRowKeys = selectedRowKeys;
        this.selectedRows = selectedRows;
      },
      onSelectRecord(record, selected, selectedRows) {
        this.selectedRows = selectedRows;
      },
      onInputSearchValueChange(e) {
        this.searchValue = e.target.value;
      },
      onSearch(e) {
        this.specialSearchSelectedValue = '';
        this.specialSearchConditionParams = null;
        this.searchValue = e;
        this.pagination.page = 1;
        this.initTableData();
      },
      cancelSelected() {
        this.selectedRowKeys = [];
        this.selectedRows = [];
        this.$refs.table.cleanSelection();
      },
      //按钮点击事件
      buttonClick(buttonKey) {
        switch (buttonKey) {
          case 'print':
            this.showPagination = false;
            this.$nextTick(() => {
              this.popprint(this.$el.outerHTML);
              this.showPagination = true;
            });
            return;
          case 'exportExcel':
            this.exportExcel(this.cachParams, this.pagination.total, {
              managerType: this.urlParamObj.managerType,
              dataType: this.dataType
            });
            return;
          case 'editWorkFlowLog':
            this.editWorkFlowLog();
            return;
          case 'smartCodeScan':
            this.showSmartCode();
            return;
          case 'batchEditAllFlow':
            let searchParams = this.cachParams;

            this.batchEditAllFlowChart(
              this.dataSource,
              () => {
                this.initTableData(this.specialSearchConditionParams);
              },
              {
                managerType: this.urlParamObj.managerType,
                dataType: this.dataType,
                searchParams: searchParams,
                urlParams: this.urlParamObj
              }
            );
            return;
          default:
            break;
        }
        if (this.selectedRowKeys.length < 1) {
          Fiber.message.warning($.i18n('supervise.please.select.operation.data'));
          return;
        }
        switch (buttonKey) {
          case 'editWorkFlow':
            if (this.selectedRowKeys.length > 1) {
              Fiber.message.warning($.i18n('supervise.onlyOne.data.operation'));
              return;
            }
            var row = this.selectedRows[0];
            this.editFlowChart(
              row,
              {
                saveDBOK: {
                  show: true,
                  callback: () => {
                    this.initTableData();
                  }
                },
                repeal: {
                  show: true,
                  callback: () => {
                    this.initTableData(null, () => {
                      this.cancelSelected();
                    });
                  }
                },
                stop: {
                  show: true,
                  callback: () => {
                    this.initTableData(null, () => {
                      this.cancelSelected();
                    });
                  }
                },
                close: {
                  show: true,
                  callback: () => {}
                }
              },
              {
                managerType: this.urlParamObj.managerType,
                dataType: this.dataType
              }
            );
            break;
          case 'batchEditFlow':
            this.batchEditFlowChart(
              this.selectedRows,
              () => {
                this.initTableData(null, () => {
                  this.cancelSelected();
                });
              },
              {
                managerType: this.urlParamObj.managerType,
                dataType: this.dataType
              }
            );
            break;

          case 'urge':
            if (this.selectedRowKeys.length > 1) {
              Fiber.message.warning($.i18n('supervise.onlyOne.data.operation'));
              return;
            }
            var row = this.selectedRows[0];
            this.urgeDealHandler(row);
            break;
          case 'deleteSupervise':
            this.deleteSupervise(this.selectedRows, () => {
              this.initTableData(this.specialSearchConditionParams);
            });
            break;
          default:
            break;
        }
      },
      handleTableChange(page, pageSize) {
        this.pagination.page = page;
        this.pagination.pageSize = pageSize;
        this.initTableData(this.specialSearchConditionParams);
      },

      initPageMetaData({ superviseBoxType, callback } = {}) {
        if (!superviseBoxType) {
          return;
        }
        const headerParams = {
          // 页面唯一标识（取值参照PageKey）
          key: 'SUPERVISE',
          // 终端 0 pc 1 mobile （取值参照PlatformType）
          platform: 0,
          // 业务传参，由业务决定（后续可在元数据拦截器中获取到）
          arguments: {
            managerType: this.urlParamObj.managerType,
            superviseBoxType: superviseBoxType,
            boardId: this.urlParamObj.boardId,
            needStatisticsVal: false,
            templateIds: this.urlParamObj.templeteIds
          }
        };
        const url = `${window._ctxPath}/rest/global/metadata/list`;

        window.axios.post(url, headerParams).then((data) => {
          if (data.data.code === 0) {
            const recieveData = data.data.data;
            loadExtendResource(recieveData.extra?.extendResources);

            this.globalParam = recieveData.globalParam || {};
            this.isAdmin = this.globalParam?.groupAdmin || this.globalParam?.administrator;
            this.showType = this.globalParam.showType;
            this.setHasProcessShowType();
            if (superviseBoxType) {
              recieveData.tableColumns.forEach((col) => {
                col.dataIndex = col.key;
                col.ellipsis = true;
                Object.assign(col, this.columnMap[col.key]);
              });
              this.columns = recieveData.tableColumns.filter((item) => item.key !== 'id');
              this.searchConditions = recieveData.searchConditions.filter((item) => {
                item.isAdministrator = this.globalParam?.administrator;
                item.managerType = this.urlParamObj?.managerType;
                return item.key !== 'subject';
              });
              this.initTableData();
              this.initProcessShowType();
            }

            callback && callback();
          }
        });
      },
      setHasProcessShowType() {
        const { isShowTotal, showType } = this.globalParam;
        const { dataType } = this;
        if (
          isShowTotal == '1' &&
          dataType != 'done' &&
          showType != 'undefined' &&
          showType != '' &&
          showType != '0'
        ) {
          this.hasProcessShowType = true;
        } else {
          this.hasProcessShowType = false;
        }
      },

      mergeUrlParams(url, params) {
        const paramsKeys = Object.keys(params);
        paramsKeys.forEach((key, index) => {
          if (params[key] !== undefined) {
            if (index === 0) {
              url += '?';
              url += `${key}=${params[key]}`;
            } else {
              url += `&${key}=${params[key]}`;
            }
          }
        });
        return url;
      },
      isRedDate(dateStr) {
        if (dateStr) {
          var str = dateStr.replace(/-/g, '/').replace(/&nbsp;/gi, ' ');
          var date = new Date(str);
          var now = new Date();
          return now > date;
        }

        return false;
      },
      conditionValueChange(data) {
        this.pagination.page = 1;
        if (data && Object.keys(data).length) {
          let params = {};
          for (let key in data) {
            switch (key) {
              case 'createDate':
                for (let k in data[key]) {
                  const keyMap = {
                    startDate: 'beginDate',
                    endDate: 'endDate'
                  };
                  params[keyMap[k]] = data[key][k];
                }
                break;
              case 'deadlineDatetime':
                for (let k in data[key]) {
                  const keyMap = {
                    startDate: 'deadlineBeginDate',
                    endDate: 'deadlineEndDate'
                  };
                  params[keyMap[k]] = data[key][k];
                }
                break;
              case 'flowstate':
                params.flowstate = data[key];
                break;
              case 'importantLevelList':
                params.importantLevelList = data[key].join(',');
                break;
              case 'startMemberName':
                params.senders = data[key].value;
                break;
              case 'currentNodesInfoStr':
                params.currentNodesInfo = data[key].value;
                break;
              case 'operationType':
                if (typeof data[key] === 'string') {
                  params.operationType = data[key];
                } else {
                  params.operationType = data[key].value;
                  params.operationTypeIds = data[key].templateValue;
                }
                break;
              default:
                break;
            }
          }
          this.advancedParams = params;
        } else {
          this.advancedParams = null;
        }

        this.specialSearchSelectedValue = '';
        this.specialSearchConditionParams = null;
        this.initTableData();
      },
      paginationShowSizeChange(current, size) {
        this.pagination.pageSize = size;
        this.initTableData(this.specialSearchConditionParams);
      },
      // 智码扫码成功后，智码预处理时，获取解码参数
      getSmartCodeDecodeParam() {
        const obj = this.cachParams;
        obj.openFrom = this.urlParamObj?.openFrom;
        return obj;
      },
      // 智码扫码成功后回调
      smartCodeCallBack(data) {
        collaboration.smartCodeCallBack(data);
      }
      // onSpecialSearchConditionClicked(value) {
      //   const params = {};
      //   if (value.templateId) {
      //     params.operationTypeIds = value.templateId;
      //     params.operationType = 'template';
      //   }

      //   if (this.showType == '1') {
      //     //按节点
      //     params.activityId = parseInt(value.id);
      //   } else if (this.showType == '2') {
      //     //按泳道
      //     params.swimlaneId = parseInt(value.id);
      //   }

      //   this.specialSearchSelectedValue = value.templateId + '-' + value.id;
      //   this.specialSearchConditionParams = params;
      //   this.pagination.page = 1;
      //   this.initTableData(params);
      // }
    },
    mounted() {}
  };
</script>

<style lang="scss">
  .supervise-mine-flow {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    width: 100%;
    display: flex;
    overflow: hidden;
    flex-direction: column;

    * {
      box-sizing: border-box;
    }

    .main-header {
      padding: 12px 16px 12px 16px;
      height: 54px;
      display: flex;

      .toolbar {
        flex: 1;
        overflow: hidden;
      }

      .search-part {
        display: flex;
        justify-content: flex-end;
        overflow: hidden;
        margin-left: 100px;

        .search-input {
          width: 272px;
        }

        .search-button {
          margin-left: 12px;
        }
      }
    }

    .main-content {
      position: relative;
      padding: 0 0 0 16px;
      flex: 1;
      overflow: hidden;

      > div {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
      }
    }

    .pointer {
      cursor: pointer;
    }
    .set-title-width {
      display: inline-block;
      width: 100%;
    }
    .link-color {
      // color: var(--theme-brand6, #1f85ec);
      color: #2490f8;
      color: var(--theme-brand5, #2490f8);
    }
    .xicon-form-text {
      color: #1f85ec;
    }
    .icon-font.wps-color {
      color: #11b5d2;
    }
    .icon-font.pfd-color {
      color: #ff4608;
    }
    .icon-font.ofd-color {
      color: #157efd;
    }
    .danger-color {
      color: #fb3a36;
    }

    .flow-state-color {
      color: #3c90b5;
    }

    .form-text-color {
      color: #67c13a;
    }
  }
  .search-condition-container {
    margin-left: 16px;
  }
  .print-supervise {
    top: 0px;
    position: relative;

    .condition-content {
      display: none;
    }
    .main-header {
      display: none;
    }
    .search-part {
      display: none;
    }
    .search-input {
      display: none;
    }
    .search-condition {
      display: none;
    }
    .search-condition-container {
      display: none;
    }
    .ant-table-body {
      height: auto !important;
      max-height: none !important;
    }
    .scrollbar {
      display: none;
    }
    .main-content > div {
      position: relative;
    }
  }
  .ant-table-middle
    > .ant-table-content
    > .ant-table-scroll
    > .ant-table-body
    > table
    > .ant-table-tbody
    > tr
    > td {
    height: 46px;
    padding: 0px 8px;
  }

  #context.content.set_ul_ls {
    // 打印的时候需要用到，解决多出一页空白的问题
    border: 1px solid white;
  }
</style>
